﻿// Copyright (c) 2011, Jonathan Clark
// All rights reserved.
//
// This software is licensed under the two-clause Simplified BSD License.
// The text of this license is available from:
// http://www.opensource.org/licenses/bsd-license.php

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NullUnit.Framework.Event
{
    public class EventRegistration<T> : IEventRegistration where T : EventArgs
    {
        IEventBus ownerBus;
        EventHandler<T> handler;

        public EventRegistration(IEventBus ownerBus, EventHandler<T> handler)
        {
            this.ownerBus = ownerBus;
            this.handler = handler;
        }

        public void Cancel()
        {
            ownerBus.RemoveHandler<T>(handler);
        }
    }
}
